﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e)
    {
        if (SiteMap.CurrentNode != null)
        {
            if (string.Equals(((IHierarchyData)e.Item.DataItem).Path, SiteMap.CurrentNode.Key, StringComparison.OrdinalIgnoreCase))
            {
                e.Item.Selected = true;
                MenuItem m = e.Item;
                if (e.Item.Selected)
                {
                    MenuItem parent = m.Parent;
                    if (parent != null)
                    {
                        if (parent.ChildItems.Count > 0)
                        {
                            parent.Selectable = true;
                            parent.Selected = true;
                        }
                        parent.Selectable = false;
                    }
                    Menu1.StaticSelectedStyle.BackColor = System.Drawing.Color.FromName("#00B3E2");

                }
            }
        }
    }
}
